﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace FYPDemo
{
    public partial class Vendor_Report : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string member = txtVendor.Text;
            string email = txtEmail.Text;
            string registerFrom = "";
            string registerTo = "";
            string dateFrom = "";
            string dateTo = "";
            int stat = Convert.ToInt32(rbStatus.SelectedValue);

            if(txtRegisteredFrom.Text != "")
                registerFrom = txtRegisteredFrom.Text + " 00:00:00.000";
            if(txtRegisteredTo.Text != "")
                registerTo = txtRegisteredTo.Text + " 23:59:59.998";
            if(txtDateFrom.Text != "")
                dateFrom = txtDateFrom.Text + " 00:00:00.000";
            if(txtDateTo.Text != "")
                dateTo = txtDateTo.Text + " 23:59:59.998";

            DataTable dt = new DataTable();

            dt = BackOffice_Report.VendorReport1(member, email, registerFrom, registerTo, dateFrom, dateTo, stat);

            VendorReport_Grid.DataSource = dt;
            VendorReport_Grid.DataBind();

            lblVendorCount.Text = dt.Rows.Count.ToString();
        }

        protected void btnExport_Click(object sender, EventArgs e)
        {
            //DateTime dt = DateTime.Now;

            //string year = dt.Year + "";
            //string month = dt.Month + "";
            //string day = dt.Day + "";
            //string fileName = "MemberReport" + year + month + day;
            //GridViewExportUtil.Export(fileName + ".xls", this.MemberReport_Grid);
        }
    }
}